<script setup>
import { useStore } from 'vuex';


const store = useStore()
const add = () => {
    // vue2 this.$store.commit('addMoney',100)
    store.commit('addMoney', 1000)
}
const addSync = () => {
    store.dispatch('addMoneyAsync', 3000)
}
</script>

<template>
    <h1>home页面</h1>
    <div>{{ store.state.money }}</div>
    <div>双倍 - {{ store.getters.double }}</div>
    <button @click="add">点我加钱</button>
    <button @click="addSync">点我异步加钱</button>
</template>
